package com.hellpro.lolbox.mine.presenter;

import com.hellpro.lolbox.mine.view.IMineVerificationActivity;
import com.hellpro.lolbox.utils.ToastShowCenter;

import cn.bmob.sms.BmobSMS;
import cn.bmob.sms.listener.VerifySMSCodeListener;

/**
 * 类描述:
 * 创建人:阿犇
 * 创建时间:2016/10/24
 * 备注:
 */

public class VerificationPresenter {
    private IMineVerificationActivity mImineVerificationActivity;

    public VerificationPresenter(IMineVerificationActivity iMineVerificationActivity) {
        this.mImineVerificationActivity = iMineVerificationActivity;
    }

    /**
     * 类描述:
     * 创建人:阿犇
     * 创建时间:2016/10/24
     * 备注:处理验证码的正确
     */

    public void setSmsCodeState() {

        final String phoneNo = mImineVerificationActivity.getPhoneNo();
        String smsCode = mImineVerificationActivity.getEtSmsMode().getText().toString();
        final String password = mImineVerificationActivity.getEtPassword().getText().toString();
        //验证验证码
        BmobSMS.verifySmsCode(mImineVerificationActivity.getVerificationContext(), phoneNo, smsCode, new VerifySMSCodeListener() {
            @Override
            public void done(cn.bmob.sms.exception.BmobException e) {
                if (e == null) {//短信验证码已验证成功
                    ToastShowCenter.centerToast(mImineVerificationActivity.getVerificationContext(), "验证码验证成功");
//                    UIManger.startToUserInfoActivity(mImineVerificationActivity.getVerificationContext(), UserInfoActivity.class, phoneNo, password);
                }
            }
        });
    }

}
